<?php

namespace SinoPHP\BbdBoss\Model;

use Upfor\UpforPHP\Model;

class CustomerDomainTemplate extends Model {
    
    /**
     * 获取源站模板列表
     *
     * 支持分页
     * 
     * @param  array   $where
     * @param  integer $pageNumber
     * @param  integer $pageSize
     * @param  arary   $orderBy
     * @return array
     */
    public function getTemplateList($where = null, $pageNumber = 1, $pageSize = 20, $orderBy = null) {
        $this->db->table($this->getTableName())->field([
            'template_id',
            'customer_user_id',
            'template_name',
            'sub_domain',
            'create_time',
            // 'FROM_UNIXTIME(create_time) as createTime',
        ]);

        $this->db->where($where);

        $this->db->page($pageNumber, $pageSize);

        if ($orderBy) {
            $this->db->order($orderBy);
        }

        return $this->db->getList();
    }
}
